package multiThreading.Account1;

public class getMoney extends Thread {
    private account1 a;
    private double money;//要从账户中取出来的钱
    private double base;
    public getMoney(String name,double base,double money){
        super(name);
        this.base=base;
        this.money=money;
    }
    @Override
    public void run() {
        if(this.a.getBase()>=this.money){//说明可以取钱
            System.out.println("取钱成功！");
            try {
                sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            this.a.setBase(this.a.getBase()-this.money);
            System.out.println("取出"+this.money);
            System.out.println("余额为：");
        }
    }
}